<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>绝对定位父子关系</title>
    <style>
        .box{
            width: 200px;
            height: 200px;
            background: yellow;
            position: relative;
            /* z-index: 100; */
        }
        .child{
            width: 100px;
            height: 100px;
            background: red;
            position: absolute;
            top: 10px;
            left: 10px;
            z-index: -1;
        }
    </style>
</head>
<body>
    <!-- 当是父子关系的时候 z-index设置到父节点无效 可以设置到子节点成负数 -->
    <div class="box">
        <div class="child"></div>
    </div>
</body>
</html>